package cn.ld.module.system.api.logger;

import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.common.util.object.BeanUtils;
import cn.ld.module.system.api.logger.dto.OperateLogCreateInDTO;
import cn.ld.module.system.api.logger.dto.OperateLogPageInDTO;
import cn.ld.module.system.api.logger.dto.OperateLogOutDTO;
import cn.ld.module.system.dal.entity.logger.OperateLogEntity;
import cn.ld.module.system.service.logger.OperateLogService;
import com.fhs.core.trans.anno.TransMethodResult;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * 操作日志 API 实现类
 *
 * @author 蓝盾
 */
@Service
@Validated
public class OperateLogApiImpl implements OperateLogApi {

    @Resource
    private OperateLogService operateLogService;

    @Override
    public void createOperateLog(OperateLogCreateInDTO createInDTO) {
        operateLogService.createOperateLog(createInDTO);
    }

    @Override
    @TransMethodResult
    public PageResult<OperateLogOutDTO> getOperateLogPage(OperateLogPageInDTO pageInDTO) {
        PageResult<OperateLogEntity> operateLogPage = operateLogService.getOperateLogPage(pageInDTO);
        return BeanUtils.toBean(operateLogPage, OperateLogOutDTO.class);
    }

}
